package org.lex;

import java.util.ArrayList;

import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.lex.collection.tree.ITreeNode;
import org.lex.lang.ReflectUtils;
import org.lex.swt.tree.TreeNodeContentProvider;

public class ClassPane extends Composite {

	public ClassPane(Composite parent) {
		super(parent, SWT.NONE);
		this.initialize();
	}

	private void initialize() {
		this.setLayout(new FillLayout());

		TreeViewer tree = new TreeViewer(this);
		tree.setContentProvider(new TreeNodeContentProvider());
		tree.setLabelProvider(new LabelProvider() {
			@Override
			public String getText(Object element) {
				return String.valueOf(((ITreeNode) element).getData());
			}
		});

		tree.setInput(ReflectUtils.getHierarchy(ArrayList.class));
	}
}
